#ifndef CCOMBOBOX_H_
#define CCOMBOBOX_H_

#include "cdefaultkeydowndynamicguiobject.h"
#include "cdefaultonadddynamicguiobject.h"
#include "ctextlistitem.h"
#include "../event/cmouseclickevent.h"
#include "../event/cmousemoveevent.h"

/**
 * CComboBox - class representing component with selection list
 * @author Michal Rost
 * @date 12.04.2008
 */
class CComboBox : public CDefaultKeyDownDynamicGuiObject,
  public CDefaultOnAddDynamicGuiObject {
public:
  CComboBox(vector<CTextListItem> comboItems);
  CComboBox(vector<string> comboItems);
  CComboBox(vector<string> comboItems, vector<int> comboItemIds);
  vector<CTextListItem>::iterator getSelection() const;
  void setComboItems(vector<CTextListItem> comboItems);
  void setComboItems(vector<string> comboItems);
  void setComboItems(vector<string> comboItems, vector<int> comboItemIds);
  static string getClassName() {
    return "CComboBox";
  }
protected:
  bool popUp;
  unsigned short comboItemHeight;
  string text;
  vector<CTextListItem> comboItems;
  vector<CTextListItem>::iterator sel;
  void init();
  void drawSelf(CGuiRenderer* rendererPtr);
  bool isFocused(CMouseEvent* eventPtr);
  bool isOverlap(CRect<int> &rect);
};

#endif
